import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import top.zxybird.demo.shardingjdbc.entity.UserEntity;
import top.zxybird.demo.shardingjdbc.mapper.UserMapper;

/**
 * App.
 *
 * Created by zxybird on 2017/9/28.
 */
public class App {

  public static void main(String[] args) {

    ApplicationContext context = new ClassPathXmlApplicationContext("sharding-jdbc.xml");

    UserMapper mapper = context.getBean(UserMapper.class);
    mapper.insertOne(new UserEntity(1, "xx", 11));
    mapper.insertOne(new UserEntity(2, "xxzzz", 11));

    System.out.println(mapper.selectByPk(1));
    System.out.println(mapper.selectByPk(2));

  }
}
